#!/usr/bin/node
const http = require('http'),
      log = console.log,
      addr = process.argv[2];
http.get(addr,(res)=>{
  //res是数据，可读流
  log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}  `);
  log(res.headers);
  let data = 0;
  res.on('data',(chunck)=>{
    data += chunck;
  });
  res.on('end',()=>{
    log(data);
  });
});

